﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Text;
using Crossroad.Utils.Extensions;

namespace Crossroad.Core.Configs
{
    /// <summary>
    /// Oauth配置
    /// </summary>
    public class OAuthConfig
    {
        /// <summary>
        /// 参数
        /// </summary>
        public static OAuthOption Option { get; } = new OAuthOption();

        public OAuthConfig(IConfiguration config)
        {
            Option.DefAppId = config["OAuthOptions:DefAppId"] ?? string.Empty;
            Option.ClientId = config["OAuthOptions:ClientId"] ?? string.Empty;
            Option.ClientSecret = config["OAuthOptions:ClientSecret"] ?? string.Empty;
            Option.AccessTokenExpires = (config["OAuthOptions:AccessTokenExpires"] ?? "24").ToInt();
            Option.RefreshTokenExpires = (config["OAuthOptions:RefreshTokenExpires"] ?? "48").ToInt();
        }


    }
}
